import request from '@/utils/request'
const base = 'http://localhost:8004'
//判断是否已经收藏文章
export function isCollection(userId, articleId) {
  return request({
    baseURL: base,
    url: `/attach/userCollection/isCollections/${userId}/${articleId}`,
    method: 'get'
  })
}
//添加或删除收藏
export function addOrDeleteCollection(userId, articleId, isAdd) {
  return request({
    baseURL: base,
    url: `/attach/userCollection/addOrDeleteCollection/${userId}/${articleId}/${isAdd}`,
    method: 'get'
  })
}
//获取收藏列表
export function getCollection(userId, pageSize, limit) {
  return request({
    baseURL: base,
    url: `/attach/userCollection/getArticleCollections/${userId}/${pageSize}/${limit}`,
    method: 'get'
  })
}
//获取单篇文章的评论
export function getCommentByArticleId(articleId, pageNo, limit) {
  return request({
    baseURL: base,
    url:`/attach/userComment/getComments/${articleId}/${pageNo}/${limit}`,
    method: 'get'
  })
}
//获取评论的回复
export function getReplayByParentId(parentId, pageNo, limit) {
  return request({
    baseURL: base,
    url:`/attach/userReplay/getReplay/${parentId}/${pageNo}/${limit}`,
    method: 'get'
  })
}
//发布评论
export function PublishComment(userId, articleId, commentContent) {
  return request({
    baseURL: base,
    url:`/attach/userComment/insertComments/${userId}/${articleId}`,
    method: 'post',
    data:commentContent
  })
}
//发布回复信息
export function PublishReplay(userId, beUserId, parentId,replayContent) {
  return request({
    baseURL: base,
    url:`/attach/userReplay/getReplay/${userId}/${beUserId}/${parentId}`,
    method: 'post',
    data:replayContent
  })
}
export function deleteComment(commentId) {
  return request({
    baseURL: base,
    url:`/attach/userComment/deleteComments/${commentId}`,
    method: 'delete'
  })
}
